<template>
  <div class="chemical">
    <eagle-page-list
      ref="eaglePageList"
      @bindData="bindData"
      :queryParams="queryParams"
      :controller="controller"
      placeholder="请输入化学品名称搜索"
      :conditions="conditions"
      :pageSize="20"
    >
      <div slot="list">
        <div
          class="add"
          @click="add()"
        >新增化学品</div>
        <eagle-cell
          style="margin-top: 10px"
          class="br-8"
          v-for="(item, index) in list"
          :key="index"
        >
          <div>
            <div @click="goDetail(item.ChemCode)">
              <eagle-row
                gutter="15"
                style="word-break:break-all"
              >
                <eagle-col>
                  <b style="font-size: 13px">{{ item.ChemName }}</b>
                </eagle-col>
              </eagle-row>

              <eagle-row gutter="15">
                <eagle-col>
                  <img
                    class="icon"
                    src="@/assets/Images/AppIcon/icon_equ_supplier.png"
                  />化学品管理员：{{ item.ChemManagerChnName || '无' }}
                </eagle-col>
              </eagle-row>
              <eagle-row gutter="20">
                <eagle-col>
                  <img
                    class="icon"
                    src="@/assets/Images/AppIcon/icon_list_danger.png"
                  />危险品：{{ item.IsDanger ? '是' : '否' }}
                </eagle-col>
              </eagle-row>
              <eagle-row gutter="20">
                <eagle-col>
                  <img
                    class="icon"
                    src="@/assets/Images/AppIcon/icon_list_type.png"
                  />其他属性：{{ item.ChemistryProp || '无' }}
                </eagle-col>
              </eagle-row>
              <van-divider />
            </div>

          </div>
          <div class="op_btn">
            <div
              class="btn_item"
              @click="edit(item.ChemCode)"
            >
              <img
                src="@/assets/Images/AppIcon/icon_list_edit.png"
                alt=""
              />
              <div class="mr-10">编辑</div>
            </div>
          </div>
        </eagle-cell>
      </div>
    </eagle-page-list>
  </div>
</template>
<script>
export default {
  data() {
    return {
      list: [],
      conditions: {},
      controller: "/ChemChemistry",
      queryParams: {
        dataType: "List",
        keywords: "",
      },
    };
  },
  methods: {
    bindData(data) {
      this.list = [];
      if (data) {
        this.list = data;
      }
    },
    add() {
      this.$router.push({
        path:'/Chemical/Edit',
      });
    },
    // 详情
    goDetail(ChemCode) {
      this.$router.push({
        path: "/Chemical/detail",
        query: { ChemCode: ChemCode },
      });
    },
    // 编辑
    edit(ChemCode) {
      this.$router.push({
        path: "/Chemical/edit",
        query: { ChemCode: ChemCode },
      });
    },
  },
};
</script>

<style lang="less">
.op_btn {
  display: flex;
  justify-content: flex-end;
  .btn_item {
    display: flex;
    align-items: center;
    img {
      height: 15px;
      width: 15px;
      margin-right: 5px;
    }
  }
}

.chemical {
  background-color: #e8f1f8;

  .info_search {
    padding: 10px;
    border-radius: 5px !important;

    .van-field__control {
      background-color: #ffffff !important;
    }
  }
}

.chemical_item {
  background-color: #ffffff;
  border-radius: 5px;
  position: relative;
}

.ch_header {
  display: flex;
  justify-content: space-between;
  position: relative;
  margin-bottom: 10px;
}

.ch_row {
  display: flex;
  align-items: center;
  margin-bottom: 5px;
  img {
    height: 15px;
    width: 15px;
    margin-right: 5px;
  }
  .ch_col {
    display: flex;
    align-items: center;
  }
}

.dep_btm {
  display: flex;
  justify-content: flex-end;

  .btm_item {
    display: flex;
    align-items: center;
    img {
      height: 15px;
      width: 15px;
      margin-right: 5px;
    }
  }
}
</style>
